package com.example.yibu.modelConfig;

import org.springframework.stereotype.Component;

import java.util.concurrent.ConcurrentHashMap;

@Component
public class HashMapConfig {
    private static final ConcurrentHashMap<Object,Object> hashMap = new ConcurrentHashMap<>();

    public void addHashMap(Object key,Object value){
        hashMap.put(key,value);
    }

    public Object getHashMap(Object key){
        return hashMap.get(key);
    }

    public Object getHashMap(Object key,Object value){
       return hashMap.getOrDefault(key, value);
    }

    public void removeHashMap(Object key){
        hashMap.remove(key);
    }


}
